﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using System.Windows.Input;

namespace BambolettaDB
{
    public class AddFilterVM: BaseVM
    {
        #region Properties and Fields
        private ObservableCollection<FilterBaseVM> _AvailableFilters = new ObservableCollection<FilterBaseVM>();
        public ObservableCollection<FilterBaseVM> AvailableFilters
        {
            get { return _AvailableFilters; }
            set { _AvailableFilters = value; NotifyPropertyChanged("AvailableFilters"); }
        }

        private FilterBaseVM _SelectedFilter;
        public FilterBaseVM SelectedFilter
        {
            get { return _SelectedFilter; }
            set { _SelectedFilter = value; NotifyPropertyChanged("SelectedFilter"); }
        }
        #endregion

        #region Commands
        private DelegateCommand _AddCommand;
        public ICommand AddCommand
        {
            get { return _AddCommand; }
        }
        public void AddExecuted(object parameter)
        {
            MainVM main = MainVM.GetInstance();
            if (main != null)
            {
                main.Filters.Add(SelectedFilter);
            }
        }
        #endregion

        #region Constructor
        public AddFilterVM()
        {
            _AddCommand = new DelegateCommand(new Action<object>(AddExecuted));
            AvailableFilters.Add(new FilterHairVM());
            AvailableFilters.Add(new FilterHairTypeVM());
            AvailableFilters.Add(new FilterEyesVM());
            AvailableFilters.Add(new FilterSkinVM());
            AvailableFilters.Add(new FilterGenderVM());
            AvailableFilters.Add(new FilterTypeVM());
            AvailableFilters.Add(new FilterStatusVM());
            AvailableFilters.Add(new FilterNameVM());
            AvailableFilters.Add(new FilterEmailVM());
            AvailableFilters.Add(new FilterLocationVM());
            SelectedFilter = AvailableFilters[0];
        }
        #endregion

    }
}
